package org.tysf.gt.junit;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.tysf.gt.dao.IStudentMsgDao;
import org.tysf.gt.pojo.Flat;
import org.tysf.gt.pojo.RepairProject;
import org.tysf.gt.pojo.Repairman;
import org.tysf.gt.pojo.StudentMsg;
import org.tysf.gt.service.IRepairmanService;
import org.tysf.gt.utils.ExcelReaderUtil;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
public class RepairManJunit {
    @Resource
    private IStudentMsgDao studentMsgDao;
    @Resource
    private IRepairmanService repairmanServie;
    @Resource
    private ExcelReaderUtil excelReaderUtil;
    @Test
    public void queryRepairmanService(){
    /*	List<Repairman> queryRepariman = repairmanServie.queryRepariman();
    	System.out.println(queryRepariman.size());
        for(Repairman repairman:queryRepariman){
        	System.out.println(repairman);
        }*/
    List<RepairProject> queryProjectByRmid = repairmanServie.queryProjectByRmid("231311");
    System.out.println(queryProjectByRmid.size());
    }

    @Test
    public void Excel(){
        System.out.println("liuyangjun"+excelReaderUtil);
    }

    @Test
    public void testAddStuBatch(){
        List<StudentMsg> studentMsgs=new ArrayList<>();
        StudentMsg studentMsg=new StudentMsg("10086","移动","移动宿舍","10086","10086");
        studentMsg.setFlat(new Flat(18));
        StudentMsg studentMsg2=new StudentMsg("10000","电信","电信宿舍","10000","10000");
        studentMsg2.setFlat(new Flat(11));
        studentMsgs.add(studentMsg);
        studentMsgs.add(studentMsg2);
        Integer result = studentMsgDao.addStuMsgByBatch(studentMsgs);
        System.out.println(result);
    }

}
